package contegor.scire.core.queries;

import contegor.scire.core.Id;
import contegor.scire.core.Link;

/**
 * This {@link Condition} filters {@link Link}s and let them pass if there target is the one given to this.
 *
 * @version $Revision$
 * @author  Héctor Cirbián Pousa ($Author$)
 */
public class TargetIs extends Condition<Link> {
  private static final long serialVersionUID = -4012172210421377636L;

  private Id targetId;

  public TargetIs(Id targetId) {
    super();
    this.targetId = targetId;
  }

  @Override
  public TargetIs clone() {
    return new TargetIs(this.targetId);
  }

  @Override
  public boolean eval(Link link) {
    return link.getTarget().equals(targetId);
  }

}
